﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LowLevelGraphics.Types
{
    /// <summary>
    /// 
    /// </summary>
    public class Sorter
    {
        /// <summary>
        /// Swaps the specified a.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="a">A.</param>
        /// <param name="b">The b.</param>
        public static void Swap<T>(ref T a, ref T b)
        {
            T t = a; a = b; b = t;
        }
        /// <summary>
        /// Sorts the specified a.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="a">A.</param>
        /// <param name="b">The b.</param>
        public static void Sort<T>(ref T a, ref T b)
            where T : IComparable<T>
        {
            if (a.CompareTo(b) > 0)
                Swap(ref a, ref b);
        }
    }
}
